#include<bits/stdc++.h>
#define int long long
#define ld long double
#define N 5005
using namespace std;
int q;
int len;
ld x[N],y[N],z[N];
ld s[N],ans[N];
int vis[N];
signed main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	scanf("%lld",&q);
	while(q--){
		int o,p;
		scanf("%lld",&o);
		if(o==1){
			len++;
			scanf("%Lf %Lf %Lf",&x[len],&y[len],&z[len]);
			s[len]=x[len]+z[len]/y[len];
			for(int i=1;i<=len;i++){
				if(vis[i]) continue;
				ans[len]+=fabsl(y[i]*(x[i]-s[len])+z[i]);
				if(i!=len) ans[i]+=fabsl(y[len]*(x[len]-s[i])+z[len]);
			}
		}
		else{
			scanf("%lld",&p);
			vis[p]=1;
			for(int i=1;i<=len;i++){
				if(vis[i]) continue;
				ans[i]-=fabsl(y[p]*(x[p]-s[i])+z[p]);
			}
		}
		ld w=0;
		int z=0;
		for(int i=1;i<=len;i++){
			if(vis[i]) continue;
			if(!z) w=ans[i];
			else w=min(w,ans[i]);
			z=1;
		}
		printf("%.12Lf\n",w);
	}
	return 0;
}
